$(document).ready(function() {
    var vids = $(".vid_6vids_01");
    for (var i = 0; i < vids.length; i++) {
        var vid = vids[i];
        var lis = $(vid).find(".wdg_carousa div:last-child ul li");
        var width=0;
        if ($(window).width() <= 624) {
            var widthDiv = parseFloat($(vid).find(".wdg_carousa div:last-child").width());
            width = widthDiv;
            $(vid).find(".wdg_carousa div:last-child ul li").css({
                "width": (widthDiv)
            });
            $(vid).find(".wdg_carousa .vid_6vids_01_elements").css({
                "overflow": "visible"
            });
            $(vid).find(".wdg_carousa .vid_6vids_01_elements").removeAttr("down");
        }
        else {
            width = 154 * lis.length;
            $(vid).find(".wdg_carousa div:last-child ul li").css({
                "width": "136"
            });
            $(vid).find(".wdg_carousa .vid_6vids_01_elements").css({
                "overflow": "hidden"
            });
            
        }
        $(vid).find(".wdg_carousa div:last-child ul").css({
            "width": width
        });

    }
    $(window).resize(function() {
        
        var vids = $(".vid_6vids_01");
        for (var i = 0; i < vids.length; i++) {
            var vid = vids[i];
            var lis = $(vid).find(".wdg_carousa div:last-child ul li");
            var width=0;
            if ($(window).width() <= 624) {
                var widthDiv = parseFloat($(vid).find(".wdg_carousa div:last-child").width());
                width = widthDiv;
                $(vid).find(".wdg_carousa div:last-child ul li").css({
                    "width": (widthDiv - 28)
                });
                $(vid).find(".wdg_carousa .vid_6vids_01_elements").css({
                    "overflow": "visible"
                });
                $(vid).find(".wdg_carousa .vid_6vids_01_elements").removeAttr("down");
                
            }
            else {
                width = 154 * lis.length;
                $(vid).find(".wdg_carousa div:last-child ul li").css({
                    "width": "136"
                });
                $(vid).find(".wdg_carousa .vid_6vids_01_elements").css({
                    "overflow": "hidden"
                });
                $(vid).find(".wdg_carousa .vid_6vids_01_elements").attr("down", "false");
            }
            $(vid).find(".wdg_carousa .vid_6vids_01_elements").animate({
                'scrollLeft': 0
            }, 500);
            $(vid).find(".wdg_carousa div:last-child ul").css({
                "width": width
            });
        }
    });
});